package com.xiashitech.agent.instrumentation.redis.lettuce;

import com.xiashitech.agent.instrumentation.redis.RedisData;
import io.opentelemetry.javaagent.shaded.io.opentelemetry.context.Context;

import java.util.function.BiConsumer;

/**
 * lettuce异步完成回调
 */
public class XSLettuceCompleteAction implements BiConsumer<Object, Throwable> {

    private Context context;

    private RedisData request;

    public XSLettuceCompleteAction(Context context, RedisData request) {
        this.context = context;
        this.request = request;
    }

    @Override
    public void accept(Object t, Throwable throwable) {
        XsLettuceSingletons.asyncInstrumenter().end(context, request, t, null);
    }

}
